﻿@using ModelToDto
@using Commonality.ServerEnum
@model List<RoleDTO>
<div class="div-table">
    <table class="table table-hover">
        <tr>
            <th>Id</th>
            <th>名称</th>
            <th>状态</th>
            <th>描述</th>
            <th>创建时间</th>
            <th>创建人</th>
            <th>操作</th>
        </tr>
        @foreach (RoleDTO item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.RoleId)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Text)
                </td>
                <td>
                    @switch ((UserStatuEnum)item.Status)
                    {
                        case UserStatuEnum.Frozen:
                            <button type="button" class="btn btn-info">@Html.DisplayFor(modelItem => item.StatusRemark)</button>
                            break;
                        case UserStatuEnum.Normal:
                            <button type="button" class="btn btn-success">@Html.DisplayFor(modelItem => item.StatusRemark)</button>
                            break;
                        case UserStatuEnum.Delete:
                            <button type="button" class="btn btn-danger">@Html.DisplayFor(modelItem => item.StatusRemark)</button>
                            break;
                        default:
                            break;
                    }
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Description)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.CreateTime)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.CreateId)
                </td>
                <td>
                    @if (item.Status == (int)(UserStatuEnum.Frozen))
                    {
                        @*  <button type="button" onclick="confirm(disable,@item.Id,'确定解禁?')" class="btn btn-info">解禁</button>*@
                        <input type="button" class="btn btn-primary" value="解禁" onclick="confirm(disable,@item.RoleId,'确定解禁?')" />
                    }
                    else
                    {
                        @* <button type="button" onclick="confirm(disable,@item.Id,'确定禁用?')" class="btn btn-danger">禁用</button>*@
                        <input type="button" class="btn btn-primary" value="禁用" onclick="confirm(disable,@item.RoleId,'确定禁用?')" />
                    }
                    ||
                    @*<button type="button" onclick="alert(234)" class="btn btn-secondary">编辑</button>*@
                    <input type="button" class="btn btn-primary" value="编辑" />
                    ||
                    <input type="button" class="btn btn-primary" onclick='location.href=("/Role/RoleMenu?roleId=@item.RoleId")' value="配置菜单" />
                    ||
                    <button type="button" onclick="confirm(ajaxDelete,@item.RoleId,'确定删除?')" class="btn btn-danger">删除</button>
                </td>
            </tr>
        }
    </table>
</div>
